package  
{
	import flash.display.Sprite;
	import IInterface.IComponent;
	/**
	 * ...
	 * @author jun
	 */
	public class MMComponent extends Sprite implements IComponent
	{
		protected var _initialization:Boolean;
		
		protected var _enable:Boolean;
	
		public function MMComponent() 
		{
			super();
			_initialization = false;
			_enable = true;
			mouseChildren = false;
		}
		
		public function set enable(v:Boolean):void
		{
			_enable = tabEnabled = tabChildren = mouseEnabled  = v;
			
		}
		
		public function setSize(width:uint, height:uint):void
		{
			
		}
		
		public function place(x:Number, y:Number):void
		{
			this.x = x;
			this.y = y;
		}
		
		public function get enable():Boolean
		{
			return _enable;
		}
		
		public function show():void
		{
			init();
			onShow();
	
		}
		
		public function swap():void
		{
			if (visible)
			{
				hide();
			}else
			{
				show();
			}
		}
		
		public function hide():void
		{
			onHide();
	
		}
		
		public function init():void
		{
			if (!initialization)
			{
				onInit();
				initialization = true;
			}
		}
		
		public function onShow():void
		{
			this.visible = true;
		}
		
		public function onHide():void
		{
			this.visible = false;
			
		}
		
		public function onInit():void
		{
			
		}
		
		public function update():void
		{
			if (visible && initialization)
			{
				updateData();
			}
		}
		public function updateData():void
		{
			
		}
		
		public function regResource():void
		{
			
		}
		
		public function get initialization():Boolean { return _initialization; }
		
		public function set initialization(value:Boolean):void 
		{
			_initialization = value;
		}
		
	
		public function gc():void
		{
			
		}
	}

}